package pe.edu.upc.iop.view;

import javax.swing.JFrame;
import com.lindo.Lingd10;


public class PrincipalGUI extends JFrame {
	
	private static final long serialVersionUID = -2588294165456109447L;
	Lingd10 lng = new Lingd10(); 
	int pnLngEnv = 0;
	int pnLngCallBack = 0;
	int pnLngErr = 0 ;
	String script = "";
	int nIterations[] = new int [2];
	@SuppressWarnings("static-access")
	public PrincipalGUI(){
		/*Properties properties = new Properties();
		properties.setProperty("properties", "lingo.properties");
		System.setProperty("properties", "lingo.properties");
		System.out.println( System.getProperty("java.library.path") );
		*/
		nIterations[0] = 1;
		nIterations[1] = 3;
		pnLngEnv = lng.LScreateEnvLng();
		System.out.println("VALOR DEL CREAR AMBIENTE LINGO :" + pnLngEnv);
		pnLngCallBack = lng.LSgetCallbackInfoIntLng( pnLngEnv, Lingd10.LS_IINFO_ITERATIONS_LNG, nIterations);
		System.out.println("VALOR DEL CALLBACK  :" + pnLngCallBack);
		
		// EJECUCION DEL SCRIPT
		// revisar el formato del archivo lingo lng y lg4
		
		// echo input to log file
		script = "SET ECHOIN 1" + "\n";	      
	    // load the model from disk
		script = script + "TAKE E:/Proyecto_IOP_Dummy.lng" + "\n";	      
	    // view the formulation
		script = script + "LOOK ALL" + "\n";	      
	    // solve
		script = script + "GO" + "\n";	      
	    // exit script processor
		script = script + "QUIT" + "\n";
		
		
		pnLngErr = lng.LSexecuteScriptLng(pnLngEnv, script);
		System.out.println("VALOR DEL EXECUTION  :" + pnLngErr);
	}
	public static void main(String[] args) {
		PrincipalGUI principalGUI = new PrincipalGUI();
		principalGUI.setSize(500, 300);
		principalGUI.setLocation(10,10);
		principalGUI.setTitle("Proyecto Investigacion de Operaciones - Dummy");
		principalGUI.setVisible(true);
		principalGUI.repaint();
		
		principalGUI.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	
	}
	static { 
		System.out.println( System.getProperty("java.library.path") ); 		
		System.loadLibrary("Lingj10");
  } 
	
}
